﻿// JavaScript Document

var sw;
var sh;
var cenX;
var cenY;

function uiInit(){
	
	resizeHandler();
	
	$(window).resize(function(e) {
		 resizeHandler();
	});
	
};

function resizeHandler(){
	
	sw = $(window).width();
	sh = $(window).height();
	
	cenX = sw/2;
	cenY = sh/2;
	
	winH = $(window).innerHeight();
	
	//kvMain
	$('#kvMain').css({
		left:cenX - $('#kvMain').width()/2,
		top:cenY - 	$('#kvMain').height()/2
	});
	
	$('#videoMain').css({
		left:sw/2 - $('#videoMain').width()/2,
		top:sh/2 - 	$('#videoMain').height()/2
	});
	
	//logo
	if( sw < 1300 ){
		TweenLite.to( $('#logo'), 0.4, { css:{ left:30}, ease:Quart.easeOut });
	}else{
		TweenLite.to( $('#logo'), 0.4, { css:{ left:cenX - $('#logo').width() - 440 }, ease:Quart.easeOut });
	};
	
	if( sh < 850 ){
		TweenLite.to( $('#logo'), 0.4, { css:{ top:30}, ease:Quart.easeOut });
	}else{
		TweenLite.to( $('#logo'), 0.4, { css:{ top:cenY -  $('#logo').height() - 240 }, ease:Quart.easeOut });
	};
	
	//preload
	$('#preLoadBox').css({
		left:cenX - $('#preLoadBox').width()/2,
		top:cenY - 	$('#preLoadBox').height()/2
	});
	
	$('#jpreLoader').css({
		left:cenX - $('#jpreLoader').width()/2,
		top:cenY - 	$('#jpreLoader').height()/2 + 100
	});
	
	//workPop
	$('#worksPop').css({
		left:cenX - $('#worksPop').width()/2,
		top:cenY - 	$('#worksPop').height()/2
	});
	
			
};